# -*- coding: utf-8 -*-
"""
Created on Sat Nov 24 12:27:56 2018

@author: Administrator
"""

# 编写矩形类
class Rectangle(object):
    def __init__(self, width, length):
        self.__width = width
        self.__length = length
    
    def get_width(self):
        return self.__width
    
    def get_length(self):
        return self.__length
    
    def area(self):
        return self.__length * self.__width
    
r = Rectangle(10, 3)
print("矩形面积：", r.area())

class Cuboid(Rectangle):
    
    def __init__(self, width, length, height):
        super(Cuboid, self).__init__( width, length)
        self.__height = height
        
    def volumn(self):
        return self.__height * super(Cuboid, self).get_length() * super(Cuboid, self).get_width()
    
    def under_area(self):
        return super(Cuboid, self).get_length() * super(Cuboid, self).get_width()
    

cub = Cuboid(10,3, 2)
print("长方体体积：", cub.volumn())
print("底面积：", cub.under_area())


class Person(object):
    def __init__(self, name, sex, age, nation):
        self.__name = name
        self.__sex = sex
        self.__age = age
        self.__nation = nation
        
    def eat(self):
        print("%s在吃饭" % self.__name)
    def sleep(self):
        print("%s在睡觉" % self.__name)
    def work(self):
        print("%s在工作" % self.__name)
        
    def get_name(self):
        return self.__name
   
geyang = Person("geyang", "man", 24, "china")
geyang.eat()

class Student(Person):
    def __init__(self, name, sex, age, nation, school, schoolId):
        super(Student, self).__init__( name, sex, age, nation)
        self.__school = school
        self.__schoolId = schoolId
        
    def work(self):
        print("%s的工作是学习" % super(Student, self).get_name())
        

lixiang = Student("lixiang", "man", 30, "china", "ncepu", 1234)
lixiang.work()

class StudentLeader(Student):
    def __init__(self, name, sex, age, nation, school, schoolId, title):
        super(StudentLeader, self).__init__( name, sex, age, nation, school, schoolId)
        self.__title = title
        
    def hold_meeting(self):
        print("%s正在开会" % super(StudentLeader, self).get_name())
        
studentLeader = StudentLeader("张三", "男", 30, "中国", "北大", 12345, "学习委员")
studentLeader.hold_meeting()